{extend name="base" /}
{block name="content"}
<div class="m-b-md">
    <h2 class="m-b-none">订单列表</h2>
</div>
<div class="row">
    <div class="col-sm-12">
        <section class="panel panel-default">
            <div class="panel-body">
                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th class="col-sm-1">订单ID</th>
                        <th>订单号</th>
                        <th>收货地址</th>
                        <th>下单时间</th>
                        <th>备注</th>
                        <th>订单状态</th>
                        <th>收货人</th>
                    </tr>
                    </thead>
                    <tbody>
                    <volist name="data" id="vo">
                        <script>
                            $(function(){
                                $('select[name=sordr]').change(function(){
                                    var sordr = $(this).find("option:selected").text();
                                    var oid = $(this).attr('oid');
//                                    alert(sordr);
//                                    alert(oid);
                                    $.ajax({
                                        type:'post',
                                        url:"{:url('admin/lists/add')}",
                                        data:{sordr:sordr,oid:oid},
                                        dataType:'json',
                                        success:function (res) {

                                        }
                                    })
                                })
                            })
                        </script>
                        {foreach name="data" item="v"}
                        <tr>
                            <td>{$v['oid']}</td>
                            <td>{$v['onumber']}</td>
                            <td>{$v['raddress']}</td>
                            <td>{:date('Y-m-d H:i:s',$v['gtime'])}</td>
                            <td>
                                <input value="{$v['remarks']}">
                                </td>
                            <td>
                                <select name="sordr" id="select" oid="{$v['oid']}">
                                    <option value="">待付款</option>
                                    <option value="">待发货</option>
                                    <option value="">待收货</option>
                                    <option value="" selected>{$v['sordr']}</option>
                                    </select>

                                </td>
                            <td>{$v['consignee']}</td>
                            <td>
                                <div class="btn-group">
                                    <a href="" class="btn btn-info">编辑</a>
                                    <a href="javascript:;" onclick="" class="btn btn-danger">删除</a>
                                </div>
                            </td>
                        </tr>
                        {/foreach}
                    </volist>
                    </tbody>
                </table>
            </div>
        </section>
    </div>
</div>
<div class="col-sm-12 text-right text-center-xs">
    <ul class="pagination pagination-sm m-t-none m-b-none">
    </ul>
</div>
<script>
    function del(bid) {
        var obj = util.modal({
            title:'确认删除吗?',//标题

            content:'',//内容

            footer:'<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button><button type="button" class="btn btn-danger confirm" data-dismiss="modal">删除</button>',//底部

            width:600,//宽度

            events:{
                confirm:function(){
                    //哪个元素上有.confirm类，被点击就执行这个回调
                    location.href = "{:url('del')}" + '?bid=' + bid;
                }
            }
        });
        //显示模态框
        obj.modal('show');
    }
</script>
{/block}